package xyz.penghaonan.adtools;

import com.penghaonan.appframework.reporter.Reporter;
import com.penghaonan.appframework.utils.GsonHelper;

import java.util.HashMap;
import java.util.Map;

import xyz.penghaonan.adtools.manager.AdSpotInfo;

public class ADReporter {
    public static void reportADLoad(long adViewId, String adViewType, AdSpotInfo spotInfo) {
        Reporter.getInstance().reportEvent("ad_tools_ad_load", spotInfo2Map(adViewId, adViewType, spotInfo));
    }

    private static Map<String, String> spotInfo2Map(long adViewId, String adViewType, AdSpotInfo spotInfo) {
        Map<String, String> values = new HashMap<>();
        values.put("adview_id", String.valueOf(adViewId));
        values.put("adview_type", adViewType);
        values.put("spot_id", spotInfo.spotId);
        values.put("spot_info", GsonHelper.toJson(spotInfo));
        return values;
    }
}
